﻿<%@ Page Title="" Language="C#" MasterPageFile="~/CricketAdmin.master" AutoEventWireup="true"
    CodeFile="AddBetting.aspx.cs" Inherits="AddBetting" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <script language="javascript" src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var flag;
        var whoseRate;


        function getCommonRate() {
            var adminId = $('#<%=hdnAdminId.ClientID %>').val();
            if (adminId != undefined && adminId != "0") {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",

                    data: "{'adminId': " + adminId + "}",
                    url: "AddBetting.aspx/getCurrentRate",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var results = data.d;
                        if (results != null) {
                            whoseRate = results[0].CommonRate;

                        }
                    },
                    error: function (response) {
                        //alert('e');
                    }
                });
            }
        }

        //        window.setInterval(function () {
        //            getCommonRate();
        //            if (whoseRate == 2) {
        //                $("#bettingDiv").hide();
        //                $("#divCommonRate").show();
        //            }
        //            else {
        //                $("#bettingDiv").show();
        //                $("#divCommonRate").hide();
        //            }

        //        }, 1000);
        $(document).ready(function () {

            $("#btnTeamAStart").hide();
            $("#btnTeamBStart").hide();
            $("#btnTeamAEnd").hide();
            $("#btnTeamBEnd").hide();
            $("#matchDraw").hide();
            $("#matchTie").hide();

            $('#<%=txtTeamAOver.ClientID %>').hide();
            $('#<%=txtTeamALagadi.ClientID %>').hide();
            $('#<%=txtTeamAKhadhi.ClientID %>').hide();
            $('#<%=txtTeamBOver.ClientID %>').hide();
            $('#<%=txtTeamBLagadi.ClientID %>').hide();
            $('#<%=txtTeamBKhadhi.ClientID %>').hide();

            if ($('#<%=drpMatch.ClientID %> option:selected').text() != "Select Match" && $('#<%=drpMatch.ClientID %> option:selected').text() != "") {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {
                    HideBettingTeamB();
                    $("#btnTeamABettingStart").show();
                    $("#btnTeamBBettingStart").show();
                }
                else if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    HideBettingTeamB();
                    if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                        $("#btnTeamABettingStart").show();
                        $("#btnTeamBBettingStart").show();
                        $("#btnDrawBettingStart").show();
                        $("#btnTieBettingStart").show();
                        $("#matchDraw").show();
                        $("#matchTie").hide();

                    }
                    else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "One Day" || $('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {
                        $("#btnTeamABettingStart").show();
                        $("#btnTeamBBettingStart").show();
                        $("#btnTieBettingStart").show();
                        $("#matchTie").show();
                    }
                }
            }

            $('#<%=txtTeamALagadi.ClientID %>').on('change', function () {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {
                        var val1 = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val() / 100) + 0.03;
                        this.value = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val() / 100).toFixed(2);
                        $('#<%=txtTeamAKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                    }
                    else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                        var val1 = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val() / 100) + 0.05;
                        this.value = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val() / 100).toFixed(2);
                        $('#<%=txtTeamAKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                    }
                    else {
                        var val1 = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val() / 100) + 0.02;
                        this.value = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val() / 100).toFixed(2);
                        $('#<%=txtTeamAKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                    }
                }
                else if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {
                    var val1 = parseInt($('#<%=txtTeamALagadi.ClientID %>').val()) + 1;
                    $('#<%=txtTeamAKhadhi.ClientID %>').val(parseFloat(val1));
                }

            });
            $('#<%=txtTeamAKhadhi.ClientID %>').on('change', function () {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    var val1 = parseFloat($('#<%=txtTeamAKhadhi.ClientID %>').val() / 100);
                    this.value = parseFloat($('#<%=txtTeamAKhadhi.ClientID %>').val() / 100);
                    $('#<%=txtTeamAKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }


            });
            $('#<%=txtTeamBLagadi.ClientID %>').on('change', function () {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {

                        var val1 = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val() / 100) + 0.03;
                        this.value = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val() / 100).toFixed(2);
                        $('#<%=txtTeamBKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                    }
                    else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {

                        var val1 = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val() / 100) + 0.05;
                        this.value = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val() / 100).toFixed(2);
                        $('#<%=txtTeamBKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                    }
                    else {
                        var val1 = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val() / 100) + 0.02;
                        this.value = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val() / 100).toFixed(2);
                        $('#<%=txtTeamBKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                    }
                }
                else if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {
                    var val1 = parseInt($('#<%=txtTeamBLagadi.ClientID %>').val()) + 1;
                    $('#<%=txtTeamBKhadhi.ClientID %>').val(parseFloat(val1));
                }

            });
            $('#<%=txtTeamBKhadhi.ClientID %>').on('change', function () {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    var val1 = parseFloat($('#<%=txtTeamBKhadhi.ClientID %>').val() / 100);
                    this.value = parseFloat($('#<%=txtTeamBKhadhi.ClientID %>').val() / 100);
                    $('#<%=txtTeamBKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }

            });
            $('#<%=txtDrawLagadi.ClientID %>').on('change', function () {
                if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {
                    var val1 = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val() / 100) + 0.03;
                    this.value = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val() / 100).toFixed(2);
                    $('#<%=txtDrawKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }
                else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                    var val1 = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val() / 100) + 0.05;
                    this.value = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val() / 100).toFixed(2);
                    $('#<%=txtDrawKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }
                else {
                    var val1 = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val() / 100) + 0.02;
                    this.value = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val() / 100).toFixed(2);
                    $('#<%=txtDrawKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }
            });
            $('#<%=txtDrawKhadhi.ClientID %>').on('change', function () {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    var val1 = parseFloat($('#<%=txtDrawKhadhi.ClientID %>').val() / 100);
                    this.value = parseFloat($('#<%=txtDrawKhadhi.ClientID %>').val() / 100);
                    $('#<%=txtDrawKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }

            });
            $('#<%=txtTieLagadi.ClientID %>').on('change', function () {
                if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {
                    var val1 = parseFloat($('#<%=txtTieLagadi.ClientID %>').val() / 100) + 0.03;
                    this.value = parseFloat($('#<%=txtTieLagadi.ClientID %>').val() / 100).toFixed(2);
                    $('#<%=txtTieKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }
                else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                    var val1 = parseFloat($('#<%=txtTieLagadi.ClientID %>').val() / 100) + 0.05;
                    this.value = parseFloat($('#<%=txtTieLagadi.ClientID %>').val() / 100).toFixed(2);
                    $('#<%=txtTieKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }
                else {
                    var val1 = parseFloat($('#<%=txtTieLagadi.ClientID %>').val() / 100) + 0.02;
                    this.value = parseFloat($('#<%=txtTieLagadi.ClientID %>').val() / 100).toFixed(2);
                    $('#<%=txtTieKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }
            });
            $('#<%=txtTieKhadhi.ClientID %>').on('change', function () {
                if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                    var val1 = parseFloat($('#<%=txtTieKhadhi.ClientID %>').val() / 100);
                    this.value = parseFloat($('#<%=txtTieKhadhi.ClientID %>').val() / 100);
                    $('#<%=txtTieKhadhi.ClientID %>').val(parseFloat(val1).toFixed(2));
                }

            });


            $('#<%=txtTeamALagadi.ClientID %>').keypress(function (event) {
                return isNumber(event)
            });
            $('#<%=txtTeamAKhadhi.ClientID %>').keypress(function (event) {
                return isNumber(event)
            });
            $('#<%=txtTeamBLagadi.ClientID %>').keypress(function (event) {
                return isNumber(event)
            });
            $('#<%=txtTeamBKhadhi.ClientID %>').keypress(function (event) {
                return isNumber(event)
            });

            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                    $("#matchTie").hide();
                    $("#matchDraw").show();
                }
                else {
                    $("#matchTie").show();
                    $("#matchDraw").hide();
                }
                $("#btnTeamABettingStart").show();
                $("#btnTeamBBettingStart").show();
                $("#btnTieBettingStart").show();
                $("#btnDrawBettingStart").show();

                //                    HideBettingTeamA();
                //                    HideBettingTeamB();
                //                    HideDraw();
                //                    HideTie();
                $('#<%=txtTeamALagadi.ClientID %>').attr("placeholder", "Lagadi");
                $('#<%=txtTeamAKhadhi.ClientID %>').attr("placeholder", "Khadhi");
                $('#<%=txtTeamBLagadi.ClientID %>').attr("placeholder", "Lagadi");
                $('#<%=txtTeamBKhadhi.ClientID %>').attr("placeholder", "Khadhi");

            }
            else {

                $("#matchTie").hide();
                $("#matchDraw").hide();
                $("#btnTeamABettingStart").show();
                $("#btnTeamBBettingStart").show();
                $("#btnTieBettingStart").hide();
                $("#btnDrawBettingStart").hide();
                //                    HideBettingTeamB();
                //                    HideBettingTeamA();
                //                    HideDraw();
                //                    HideTie();
                $('#<%=txtTeamALagadi.ClientID %>').attr("placeholder", "Khadhi");
                $('#<%=txtTeamAKhadhi.ClientID %>').attr("placeholder", "Lagadi");
                $('#<%=txtTeamBLagadi.ClientID %>').attr("placeholder", "Khadhi");
                $('#<%=txtTeamBKhadhi.ClientID %>').attr("placeholder", "Lagadi");
            }



            $('#<%=txtTeamAOver.ClientID %>').keyup(function () {
                var textboxValue = $('#<%=txtTeamAOver.ClientID %>').val();
                if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "One Day") {
                    if (textboxValue.length == 2) {
                        $('#<%=txtTeamALagadi.ClientID %>').focus();
                    }
                }
                else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                    if (textboxValue.length == 3) {
                        $('#<%=txtTeamALagadi.ClientID %>').focus();
                    }
                }
                else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {
                    if (textboxValue.length == 2) {
                        $('#<%=txtTeamALagadi.ClientID %>').focus();
                    }
                }
            });

            $('#<%=txtTeamBOver.ClientID %>').keyup(function () {
                var textboxValue = $('#<%=txtTeamBOver.ClientID %>').val();
                if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "One Day") {
                    if (textboxValue.length == 2) {
                        $('#<%=txtTeamBLagadi.ClientID %>').focus();
                    }
                }
                else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "Test") {
                    if (textboxValue.length == 3) {
                        $('#<%=txtTeamBLagadi.ClientID %>').focus();
                    }
                }
                else if ($('#<%=drpMatchType.ClientID %> option:selected').text() == "T20") {
                    if (textboxValue.length == 2) {
                        $('#<%=txtTeamBLagadi.ClientID %>').focus();
                    }
                }
            });

        });


        function isNumber(evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode != 45 && (charCode != 46 || $(this).val().indexOf('.') != -1) &&
                (charCode < 48 || charCode > 57))
                return false;

            return true;
        }
        function StartBettingTeamA() {
            $('#<%=txtTeamALagadi.ClientID %>').show();
            $('#<%=txtTeamAKhadhi.ClientID %>').show();

            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {
                HideBettingTeamB();
                $("#btnTeamABettingStart").hide();
                $("#btnTeamBBettingStart").hide();
                $('#<%=txtTeamAOver.ClientID %>').show();
                $('#<%=txtTeamAOver.ClientID %>').focus();
            }
            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                $('#<%=txtTeamAOver.ClientID %>').hide();
                $("#btnTeamABettingStart").hide();
                $('#<%=txtTeamALagadi.ClientID %>').focus();
            }
            else {
                HideBettingTeamB();
                $("#btnTeamABettingStart").hide();
                $("#btnTeamBBettingStart").hide();
                $('#<%=txtTeamAOver.ClientID %>').show();
                $('#<%=txtTeamAOver.ClientID %>').focus();
            }

            $("#btnTeamAStart").show();
        }
        function HideBettingTeamA() {
            $("#btnTeamBBettingStart").show();
            $("#btnTeamABettingStart").hide();

            $('#<%=txtTeamALagadi.ClientID %>').hide();
            $('#<%=txtTeamAKhadhi.ClientID %>').hide();
            $('#<%=txtTeamAOver.ClientID %>').hide();
            $("#btnTeamAStart").hide();
            $("#btnTeamAEnd").hide();
        }
        function StartBettingTeamB() {
            $('#<%=txtTeamBLagadi.ClientID %>').show();
            $('#<%=txtTeamBKhadhi.ClientID %>').show();
            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {
                HideBettingTeamA();
                $("#btnTeamABettingStart").hide();
                $("#btnTeamBBettingStart").hide();
                $('#<%=txtTeamBOver.ClientID %>').show();
                $('#<%=txtTeamBOver.ClientID %>').focus();
            }
            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                $('#<%=txtTeamBOver.ClientID %>').hide();
                $("#btnTeamBBettingStart").hide();
                $('#<%=txtTeamBLagadi.ClientID %>').focus();
            }
            $("#btnTeamBStart").show();
        }
        function HideBettingTeamB() {
            $("#btnTeamABettingStart").show();
            $("#btnTeamBBettingStart").hide();
            $('#<%=txtTeamBLagadi.ClientID %>').hide();
            $('#<%=txtTeamBKhadhi.ClientID %>').hide();
            $('#<%=txtTeamBOver.ClientID %>').hide();
            $("#btnTeamBStart").hide();
            $("#btnTeamBEnd").hide();
        }
        function HideDraw() {
            $("#btnDrawBettingStart").show();
            $('#<%=txtDrawLagadi.ClientID %>').hide();
            $('#<%=txtDrawKhadhi.ClientID %>').hide();
            $("#btnDrawStart").hide();
            $("#btnDrawEnd").hide();
        }
        function HideTie() {
            $("#btnTieBettingStart").show();
            $('#<%=txtTieLagadi.ClientID %>').hide();
            $('#<%=txtTieKhadhi.ClientID %>').hide();
            $("#btnTieStart").hide();
            $("#btnTieEnd").hide();
        }
        function StartDrawBetting() {
            $("#btnDrawBettingStart").hide();
            $('#<%=txtDrawLagadi.ClientID %>').show();
            $('#<%=txtDrawKhadhi.ClientID %>').show();
            $('#<%=txtDrawLagadi.ClientID %>').focus();
            $("#btnDrawStart").show();
            $("#btnDrawEnd").hide();
        }
        function StartTieBetting() {
            $("#btnTieBettingStart").hide();
            $('#<%=txtTieLagadi.ClientID %>').show();
            $('#<%=txtTieLagadi.ClientID %>').focus();
            $('#<%=txtTieKhadhi.ClientID %>').show();
            $("#btnTieStart").show();
            $("#btnTieEnd").hide();
        }

        function SaveBetting(whichTeam) {

            var bettingTypeId = $('#<%=drpBettingType.ClientID %>').val();
            var matchTypeId = $('#<%=drpMatchType.ClientID %>').val();
            var matchScheduleId = $('#<%=drpMatch.ClientID %>').val();
            var teamId = 0;
            var lagadiRate = 0;
            var khadhiRate = 0;
            var over = 0;
            var drawLagadi = 0;
            var drawKhadhi = 0;
            var tieLagadi = 0;
            var tieKhadhi = 0;
            var isDraw = false;
            var isTie = false;

            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {
                if (whichTeam == 'teamA') {
                    $("#btnTeamBBettingStart").hide();
                    if (($('#<%=txtTeamALagadi.ClientID %>').val() != "") && ($('#<%=txtTeamAKhadhi.ClientID %>').val() != "")) {
                        $("#teamA").removeClass("error");

                        var teamAL = parseInt($('#<%=txtTeamALagadi.ClientID %>').val());
                        var teamAK = parseInt($('#<%=txtTeamAKhadhi.ClientID %>').val());

                        if (teamAL >= teamAK) {
                            //Display Validation for Entering Data.
                            $("#teamA").addClass("error");
                            return;
                        }
                        else {
                            over = $('#<%=txtTeamAOver.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamAOver.ClientID %>').val();
                            teamId = $('#<%=hdnTeamAId.ClientID %>').val() == '' ? 0 : $('#<%=hdnTeamAId.ClientID %>').val();
                            lagadiRate = $('#<%=txtTeamALagadi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamALagadi.ClientID %>').val();
                            khadhiRate = $('#<%=txtTeamAKhadhi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamAKhadhi.ClientID %>').val();
                        }
                    }
                    else {
                        //Display Validation for Entering Data.
                        $("#teamA").addClass("error");
                        return;
                    }
                }

                if (whichTeam == 'teamB') {
                    $("#btnTeamABettingStart").hide();
                    if (($('#<%=txtTeamBLagadi.ClientID %>').val() != "") && ($('#<%=txtTeamBKhadhi.ClientID %>').val() != "")) {
                        $("#teamB").removeClass("error");

                        var teamBL = parseInt($('#<%=txtTeamBLagadi.ClientID %>').val());
                        var teamBK = parseInt($('#<%=txtTeamBKhadhi.ClientID %>').val());

                        if (teamBL >= teamBK) {
                            //Display Validation for Entering Data.
                            $("#teamB").addClass("error");
                            return;
                        }
                        else {

                            over = $('#<%=txtTeamBOver.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamBOver.ClientID %>').val();
                            teamId = $('#<%=hdnTeamBId.ClientID %>').val() == '' ? 0 : $('#<%=hdnTeamBId.ClientID %>').val();
                            lagadiRate = $('#<%=txtTeamBLagadi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamBLagadi.ClientID %>').val();
                            khadhiRate = $('#<%=txtTeamBKhadhi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamBKhadhi.ClientID %>').val();
                        }
                    }
                    else {
                        //Display Validation for Entering Data.
                        $("#teamB").addClass("error");
                        return;
                    }
                }
            }

            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                if (whichTeam == 'teamA') {
                    if (($('#<%=txtTeamALagadi.ClientID %>').val() != "") && ($('#<%=txtTeamAKhadhi.ClientID %>').val() != "")) {
                        $("#teamA").removeClass("error");
                        var teamAL = parseFloat($('#<%=txtTeamALagadi.ClientID %>').val());
                        var teamAK = parseFloat($('#<%=txtTeamAKhadhi.ClientID %>').val());

                        if (teamAL >= teamAK) {
                            //Display Validation for Entering Data.
                            $("#teamA").addClass("error");
                            return;
                        }
                        else {
                            over = $('#<%=txtTeamAOver.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamAOver.ClientID %>').val();
                            teamId = $('#<%=hdnTeamAId.ClientID %>').val() == '' ? 0 : $('#<%=hdnTeamAId.ClientID %>').val();
                            lagadiRate = $('#<%=txtTeamALagadi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamALagadi.ClientID %>').val();
                            khadhiRate = $('#<%=txtTeamAKhadhi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamAKhadhi.ClientID %>').val();
                        }

                    }
                    else {
                        //Display Validation for Entering Data.
                        $("#teamA").addClass("error");
                        return;
                    }
                }

                if (whichTeam == 'teamB') {
                    if (($('#<%=txtTeamBLagadi.ClientID %>').val() != "") && ($('#<%=txtTeamBKhadhi.ClientID %>').val() != "")) {
                        $("#teamB").removeClass("error");
                        var teamBL = parseFloat($('#<%=txtTeamBLagadi.ClientID %>').val());
                        var teamBK = parseFloat($('#<%=txtTeamBKhadhi.ClientID %>').val());

                        if (teamBL >= teamBK) {
                            //Display Validation for Entering Data.
                            $("#teamB").addClass("error");
                            return;
                        }
                        else {
                            over = $('#<%=txtTeamBOver.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamBOver.ClientID %>').val();
                            teamId = $('#<%=hdnTeamBId.ClientID %>').val() == '' ? 0 : $('#<%=hdnTeamBId.ClientID %>').val();
                            lagadiRate = $('#<%=txtTeamBLagadi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamBLagadi.ClientID %>').val();
                            khadhiRate = $('#<%=txtTeamBKhadhi.ClientID %>').val() == '' ? 0 : $('#<%=txtTeamBKhadhi.ClientID %>').val();
                        }
                    }
                    else {
                        //Display Validation for Entering Data.
                        $("#teamB").addClass("error");
                        return;
                    }
                }

                if (whichTeam == 'teamDraw') {
                    if (($('#<%=txtDrawLagadi.ClientID %>').val() != "") && ($('#<%=txtDrawKhadhi.ClientID %>').val() != "")) {
                        $("#teamDraw").removeClass("error");
                        var teamDL = parseFloat($('#<%=txtDrawLagadi.ClientID %>').val());
                        var teamDK = parseFloat($('#<%=txtDrawKhadhi.ClientID %>').val());

                        if (teamDL >= teamDK) {
                            //Display Validation for Entering Data.
                            $("#teamDraw").addClass("error");
                            return;
                        }
                        else {
                            drawLagadi = $('#<%=txtDrawLagadi.ClientID %>').val() == '' ? 0 : $('#<%=txtDrawLagadi.ClientID %>').val();
                            drawKhadhi = $('#<%=txtDrawKhadhi.ClientID %>').val() == '' ? 0 : $('#<%=txtDrawKhadhi.ClientID %>').val();
                            isDraw = true;
                            teamId = 32;
                        }
                    }
                    else {
                        //Display Validation for Entering Data.
                        $("#teamDraw").addClass("error");
                        return;
                    }
                }
                if (whichTeam == 'teamTie') {
                    if (($('#<%=txtTieLagadi.ClientID %>').val() != "") && ($('#<%=txtTieKhadhi.ClientID %>').val() != "")) {
                        $("#teamTie").removeClass("error");
                        var teamTL = parseFloat($('#<%=txtTieLagadi.ClientID %>').val());
                        var teamTK = parseFloat($('#<%=txtTieKhadhi.ClientID %>').val());

                        if (teamTL >= teamTK) {
                            //Display Validation for Entering Data.
                            $("#teamTie").addClass("error");
                            return;
                        }
                        else {
                            tieLagadi = $('#<%=txtTieLagadi.ClientID %>').val() == '' ? 0 : $('#<%=txtTieLagadi.ClientID %>').val();
                            tieKhadhi = $('#<%=txtTieKhadhi.ClientID %>').val() == '' ? 0 : $('#<%=txtTieKhadhi.ClientID %>').val();
                            isTie = true;
                            teamId = 31;
                        }
                    }
                    else {
                        //Display Validation for Entering Data.
                        $("#teamTie").addClass("error");
                        return;
                    }
                }
                
            }

            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                data: "{'bettingTypeId': " + bettingTypeId + ",'matchTypeId':" + matchTypeId + ", 'matchScheduleId':" + matchScheduleId + ",'teamId': " + teamId + ",'over':" + over + ",'lagadiRate': " + lagadiRate + ",'khadhiRate':" + khadhiRate + ",'drawLagadi': " + drawLagadi + ",'drawKhadhi': " + drawKhadhi + ",'isDraw': " + isDraw + ",'tieLagadi': " + tieLagadi + ",'tieKhadhi': " + tieKhadhi + ",'isTie': " + isTie + "}",
                url: "AddBetting.aspx/SaveBettingRecords",
                dataType: "json",
                success: function (data) {
                    if (data.d == 1) {
                        if (whichTeam == 'teamA') {
                            $("#btnTeamAEnd").show();
                            $("#btnTeamAStart").removeClass("btn hide");
                            $("#btnTeamAStart").addClass("btn red");
                            $("#btnTeamAStart").prop("disabled", true);
                            $('#btnTeamAEnd').focus();
                        }
                        if (whichTeam == 'teamB') {
                            $("#btnTeamBEnd").show();
                            $("#btnTeamBStart").removeClass("btn hide");
                            $("#btnTeamBStart").addClass("btn red");
                            $("#btnTeamBStart").prop("disabled", true);
                            $('#btnTeamBEnd').focus();
                        }
                        if (whichTeam == 'teamDraw') {
                            $("#btnDrawEnd").show();
                            $("#btnDrawStart").removeClass("btn hide");
                            $("#btnDrawStart").addClass("btn red");
                            $("#btnDrawStart").prop("disabled", true);
                            $('#btnDrawEnd').focus();
                        }
                        if (whichTeam == 'teamTie') {
                            $("#btnTieEnd").show();
                            $("#btnTieStart").removeClass("btn hide");
                            $("#btnTieStart").addClass("btn red");
                            $("#btnTieStart").prop("disabled", true);
                            $('#btnTieEnd').focus();
                        }
                    }
                },
                error: function (response) {
                    alert(response.responseText);
                }
            });


            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Session") {

                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    data: "{'matchTypeId':" + matchTypeId + ", 'matchScheduleId':" + matchScheduleId + ",'teamId': " + teamId + ",'over':" + over + ",'lagadiRate': " + lagadiRate + "}",
                    url: "AddBetting.aspx/SaveFancyBettingRecords",
                    dataType: "json",
                    success: function (data) {
                        if (data.d == 1) {
                            if (whichTeam == 'teamA') {
                                $("#btnTeamAEnd").show();
                                $("#btnTeamAStart").removeClass("btn hide");
                                $("#btnTeamAStart").addClass("btn red");
                                $("#btnTeamAStart").prop("disabled", true);
                                $('#btnTeamAEnd').focus();
                            }
                            if (whichTeam == 'teamB') {
                                $("#btnTeamBEnd").show();
                                $("#btnTeamBStart").removeClass("btn hide");
                                $("#btnTeamBStart").addClass("btn red");
                                $("#btnTeamBStart").prop("disabled", true);
                                $('#btnTeamBEnd').focus();
                            }

                        }
                    },
                    error: function (response) {
                        alert(response.responseText);
                    }
                });
            }

            document.getElementById('<%=btnShowReport.ClientID %>').click();
        }

        function UpdateBetting(whichTeam) {

            var bettingTypeId = $('#<%=drpBettingType.ClientID %>').val();
            if (whichTeam == 'teamA') {
                var lagadi = $('#<%=txtTeamALagadi.ClientID %>').val();
                var khadhi = $('#<%=txtTeamAKhadhi.ClientID %>').val();
            }
            else if (whichTeam = 'teamB') {
                var lagadi = $('#<%=txtTeamBLagadi.ClientID %>').val();
                var khadhi = $('#<%=txtTeamBKhadhi.ClientID %>').val();
            }
            if ($('#<%=drpBettingType.ClientID %> option:selected').text() == "Match") {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    data: "{'bettingTypeId': " + bettingTypeId + ",'lagadi':" + lagadi + ", 'khadhi':" + khadhi + "}",
                    url: "AddBetting.aspx/UpdateBettingRecordsForMatch",
                    dataType: "json",
                    success: function (data) {
                        if (data.d == 1) {
                            if (whichTeam == 'teamA') {
                                $("#btnTeamAEnd").hide();
                                $("#btnTeamAStart").show();
                                $("#btnTeamABettingStart").hide();
                                //$("#btnTeamBBettingStart").hide();
                                $("#btnTeamAStart").removeClass("btn red");
                                $("#btnTeamAStart").addClass("btn");
                                $("#btnTeamAStart").prop("disabled", false);
                                $('#<%=txtTeamALagadi.ClientID %>').focus();
                                var teamAL = $('#<%=txtTeamALagadi.ClientID %>').val();
                                var teamAK = $('#<%=txtTeamAKhadhi.ClientID %>').val();
                                $('#<%=txtTeamALagadi.ClientID %>').attr("placeholder", teamAL);
                                $('#<%=txtTeamAKhadhi.ClientID %>').attr("placeholder", teamAK);
                                $('#<%=txtTeamALagadi.ClientID %>').val('');
                                $('#<%=txtTeamAKhadhi.ClientID %>').val('');


                            }
                            if (whichTeam == 'teamB') {
                                $("#btnTeamBEnd").hide();
                                $("#btnTeamBStart").show();
                                $("#btnTeamBBettingStart").hide();
                                //$("#btnTeamABettingStart").hide();
                                $("#btnTeamBStart").removeClass("btn red");
                                $("#btnTeamBStart").addClass("btn");
                                $("#btnTeamBStart").prop("disabled", false);
                                $('#<%=txtTeamBLagadi.ClientID %>').focus();
                                var teamBL = $('#<%=txtTeamBLagadi.ClientID %>').val();
                                var teamBK = $('#<%=txtTeamBKhadhi.ClientID %>').val();
                                $('#<%=txtTeamBLagadi.ClientID %>').attr("placeholder", teamBL);
                                $('#<%=txtTeamBKhadhi.ClientID %>').attr("placeholder", teamBK);
                                $('#<%=txtTeamBLagadi.ClientID %>').val('');
                                $('#<%=txtTeamBKhadhi.ClientID %>').val('');

                            }
                            document.getElementById('<%=btnShowReport.ClientID %>').click();
                        }
                    },
                    error: function (response) {
                        alert(response.responseText);
                    }
                });
            }
            else {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    data: "{'bettingTypeId':'" + bettingTypeId + "'}",
                    url: "AddBetting.aspx/UpdateBettingRecords",
                    dataType: "json",
                    success: function (data) {
                        if (data.d == 1) {
                            if (whichTeam == 'teamA') {
                                $("#btnTeamAEnd").hide();
                                $("#btnTeamAStart").show();
                                $("#btnTeamABettingStart").hide();
                                $("#btnTeamBBettingStart").show();
                                $("#btnTeamAStart").removeClass("btn red");
                                $("#btnTeamAStart").addClass("btn");
                                $("#btnTeamAStart").prop("disabled", false);
                                $('#<%=txtTeamALagadi.ClientID %>').focus();
                                var teamAL = $('#<%=txtTeamALagadi.ClientID %>').val();
                                var teamAK = $('#<%=txtTeamAKhadhi.ClientID %>').val();
                                $('#<%=txtTeamALagadi.ClientID %>').attr("placeholder", teamAL);
                                $('#<%=txtTeamAKhadhi.ClientID %>').attr("placeholder", teamAK);
                                $('#<%=txtTeamALagadi.ClientID %>').val('');
                                $('#<%=txtTeamAKhadhi.ClientID %>').val('');


                            }
                            if (whichTeam == 'teamB') {
                                $("#btnTeamBEnd").hide();
                                $("#btnTeamBStart").show();
                                $("#btnTeamBBettingStart").hide();
                                $("#btnTeamABettingStart").show();
                                $("#btnTeamBStart").removeClass("btn red");
                                $("#btnTeamBStart").addClass("btn");
                                $("#btnTeamBStart").prop("disabled", false);
                                $('#<%=txtTeamBLagadi.ClientID %>').focus();
                                var teamBL = $('#<%=txtTeamBLagadi.ClientID %>').val();
                                var teamBK = $('#<%=txtTeamBKhadhi.ClientID %>').val();
                                $('#<%=txtTeamBLagadi.ClientID %>').attr("placeholder", teamBL);
                                $('#<%=txtTeamBKhadhi.ClientID %>').attr("placeholder", teamBK);
                                $('#<%=txtTeamBLagadi.ClientID %>').val('');
                                $('#<%=txtTeamBKhadhi.ClientID %>').val('');

                            }
                            document.getElementById('<%=btnShowReport.ClientID %>').click();
                        }
                    },
                    error: function (response) {
                        alert('Error');
                    }
                });
            }
        }

        function UpdateBettingForDraw() {
            var bettingTypeId = $('#<%=drpBettingType.ClientID %>').val();
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                data: "{'bettingTypeId':'" + bettingTypeId + "'}",
                url: "AddBetting.aspx/UpdateBettingForDrawRecords",
                dataType: "json",
                success: function (data) {
                    if (data.d == 1) {
                        $("#btnDrawEnd").hide();
                        $("#btnDrawStart").show();
                        $("#btnDrawBettingStart").hide();
                        $("#btnDrawStart").removeClass("btn red");
                        $("#btnDrawStart").addClass("btn");
                        $("#btnDrawStart").prop("disabled", false);
                        $('#<%=txtDrawLagadi.ClientID %>').focus();
                        var teamDL = $('#<%=txtDrawLagadi.ClientID %>').val();
                        var teamDK = $('#<%=txtDrawKhadhi.ClientID %>').val();
                        $('#<%=txtDrawLagadi.ClientID %>').attr("placeholder", teamDL);
                        $('#<%=txtDrawKhadhi.ClientID %>').attr("placeholder", teamDK);
                        $('#<%=txtDrawLagadi.ClientID %>').val('');
                        $('#<%=txtDrawKhadhi.ClientID %>').val('');

                    }
                    document.getElementById('<%=btnShowReport.ClientID %>').click();
                },
                error: function (response) {
                    alert('Error');
                }
            });
        }
        function UpdateBettingForTie() {
            var bettingTypeId = $('#<%=drpBettingType.ClientID %>').val();
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                data: "{'bettingTypeId':'" + bettingTypeId + "'}",
                url: "AddBetting.aspx/UpdateBettingForTieRecords",
                dataType: "json",
                success: function (data) {
                    if (data.d == 1) {
                        $("#btnTieEnd").hide();
                        $("#btnTieStart").show();
                        $("#btnTieBettingStart").hide();
                        $("#btnTieStart").removeClass("btn red");
                        $("#btnTieStart").addClass("btn");
                        $("#btnTieStart").prop("disabled", false);
                        $('#<%=txtTieLagadi.ClientID %>').focus();
                        var teamTL = $('#<%=txtTieLagadi.ClientID %>').val();
                        var teamTK = $('#<%=txtTieKhadhi.ClientID %>').val();
                        $('#<%=txtTieLagadi.ClientID %>').attr("placeholder", teamTL);
                        $('#<%=txtTieKhadhi.ClientID %>').attr("placeholder", teamTK);
                        $('#<%=txtTieLagadi.ClientID %>').val('');
                        $('#<%=txtTieKhadhi.ClientID %>').val('');
                    }
                    document.getElementById('<%=btnShowReport.ClientID %>').click();
                },
                error: function (response) {
                    alert('Error');
                }
            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:HiddenField ID="hdnTeamAId" runat="server" />
    <asp:HiddenField ID="hdnTeamBId" runat="server" />
    <asp:HiddenField ID="hdnAdminId" runat="server" />
    <div class="container-fluid">
        <h3 class="page-title">
            Betting<small></small>
        </h3>
        <div class="alert alert-danger" id="layerError" runat="server" style="display: none;">
        </div>
        <div class="alert alert-success" id="layerSuccess" runat="server" style="display: none;">
        </div>
        <div id="divCommonRate" style="display: none;">
            Please <a href="MyProfile.aspx">click here</a> to change the rate.
        </div>
        <div class="row-fluid" id="bettingDiv">
            <div class="span12">
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            Betting</div>
                    </div>
                    <div class="portlet-body form">
                        <div class="form-horizontal form-view">
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Match Type <span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:DropDownList ID="drpMatchType" runat="server" OnSelectedIndexChanged="drpMatchType_SelectedIndexChanged"
                                                AutoPostBack="true">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter match type"
                                                InitialValue="0" ValidationGroup="Betting" CssClass="required" ControlToValidate="drpMatchType"
                                                Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Select Match<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:DropDownList ID="drpMatch" runat="server" OnSelectedIndexChanged="drpMatch_SelectedIndexChanged"
                                                AutoPostBack="true">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please enter match"
                                                InitialValue="0" ValidationGroup="Betting" CssClass="required" ControlToValidate="drpMatch"
                                                Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Betting Type<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:DropDownList ID="drpBettingType" runat="server">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Please enter betting type"
                                                InitialValue="0" ValidationGroup="Betting" CssClass="required" ControlToValidate="drpBettingType"
                                                Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="control-group" id="teamA">
                                    <label class="control-label">
                                        <asp:Label ID="lblTeamA" runat="server" CssClass="span6 m-wrap"> </asp:Label>
                                    </label>
                                    <div class="controls">
                                        <input id="btnTeamABettingStart" type="button" value="Start" class="btn hide" onclick="StartBettingTeamA()" />
                                        <asp:TextBox ID="txtTeamAOver" runat="server" placeholder="Over" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <asp:TextBox ID="txtTeamALagadi" runat="server" placeholder="Lagadi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <asp:TextBox ID="txtTeamAKhadhi" runat="server" placeholder="Khadhi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <input id="btnTeamAStart" type="button" value="BroadCast" class="btn hide" onclick="SaveBetting('teamA')" />
                                        <input id="btnTeamAEnd" type="button" value="End" class="btn hide" onclick="UpdateBetting('teamA')" />
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="control-group" id="teamB">
                                    <label class="control-label">
                                        <asp:Label ID="lblTeamB" runat="server" CssClass="span6 m-wrap"></asp:Label>
                                    </label>
                                    <div class="controls">
                                        <input id="btnTeamBBettingStart" type="button" value="Start" class="btn hide" onclick="StartBettingTeamB()" />
                                        <asp:TextBox ID="txtTeamBOver" runat="server" placeholder="Over" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <asp:TextBox ID="txtTeamBLagadi" runat="server" placeholder="Lagadi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <asp:TextBox ID="txtTeamBKhadhi" runat="server" placeholder="Khadhi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <input id="btnTeamBStart" type="button" value="BroadCast" class="btn hide" onclick="SaveBetting('teamB')" />
                                        <input id="btnTeamBEnd" type="button" value="End" class="btn hide" onclick="UpdateBetting('teamB')" />
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid" id="matchDraw">
                                <div class="control-group" id="teamDraw">
                                    <label class="control-label">
                                        <asp:Label ID="lblDraw" runat="server" CssClass="span6 m-wrap">Draw</asp:Label>
                                    </label>
                                    <div class="controls">
                                        <input id="btnDrawBettingStart" type="button" value="Start" class="btn hide" onclick="StartDrawBetting()" />
                                        <asp:TextBox ID="txtDrawLagadi" runat="server" placeholder="Lagadi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <asp:TextBox ID="txtDrawKhadhi" runat="server" placeholder="Khadhi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <input id="btnDrawStart" type="button" value="BroadCast" class="btn hide" onclick="SaveBetting('teamDraw')" />
                                        <input id="btnDrawEnd" type="button" value="End" class="btn hide" onclick="UpdateBettingForDraw()" />
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid" id="matchTie">
                                <div class="control-group" id="teamTie">
                                    <label class="control-label">
                                        <asp:Label ID="lblTie" runat="server" CssClass="span6 m-wrap">Tie</asp:Label>
                                    </label>
                                    <div class="controls">
                                        <input id="btnTieBettingStart" type="button" value="Start" class="btn hide" onclick="StartTieBetting()" />
                                        <asp:TextBox ID="txtTieLagadi" runat="server" placeholder="Lagadi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <asp:TextBox ID="txtTieKhadhi" runat="server" placeholder="Khadhi" CssClass="m-wrap span2 hide"></asp:TextBox>
                                        <input id="btnTieStart" type="button" value="BroadCast" class="btn hide" onclick="SaveBetting('teamTie')" />
                                        <input id="btnTieEnd" type="button" value="End" class="btn hide" onclick="UpdateBettingForTie()" />
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid" id="Div1">
                                <div class="control-group" id="Div2">
                                    <div class="controls">
                                        <asp:Button ID="btnStopAll" CssClass="btn red" runat="server" Text="Stop All" OnClick="btnStopAll_Click" />
                                    </div>
                                </div>
                                <div class="control-group" id="Div3" style="display: none;">
                                    <div class="controls">
                                        <asp:Button ID="btnShowReport" CssClass="btn red" runat="server" Text="Report" OnClick="btnReport_Click" />
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="btnShowReport" />
                                    </Triggers>
                                    <ContentTemplate>
                                        <div class="span6">
                                            <asp:GridView ID="grdCustomerBettingMatch" runat="server" AutoGenerateColumns="False"
                                                CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" OnRowDataBound="grdCustomerBettingMatch_RowDataBound">
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                <Columns>
                                                    <%--<asp:BoundField DataField="Abbrivation" HeaderText="Team Name" HeaderStyle-HorizontalAlign="Left" />
                                        <asp:BoundField DataField="Rate" HeaderText="Rate" HeaderStyle-HorizontalAlign="Left" />
                                        <asp:BoundField DataField="BettingFor" HeaderText="K/L" HeaderStyle-HorizontalAlign="Left" />--%>
                                                    <asp:BoundField DataField="BettingAmount" HeaderText="Betting Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="TeamAAmount" HeaderText="TeamA Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="TeamBAmount" HeaderText="TeamB Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="DrawAmount" HeaderText="Draw Chips" HeaderStyle-HorizontalAlign="Left" />
                                                </Columns>
                                                <EditRowStyle BackColor="#999999" />
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                            </asp:GridView>
                                        </div>
                                        <div class="span6">
                                            <asp:Label ID="Label1" runat="server"></asp:Label>
                                            <asp:Label ID="Label2" runat="server"></asp:Label>
                                            <asp:Label ID="Label3" runat="server"></asp:Label>
                                            <asp:GridView ID="grd90110" runat="server" AutoGenerateColumns="False"
                                                CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%">
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                <Columns>
                                                    <asp:BoundField DataField="FullName" HeaderText="Client Name" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Abbrivation" HeaderText="Team Name" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Over" HeaderText="Over" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Rate" HeaderText="Run" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="BettingFor" HeaderText="K/L" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="BettingAmount" HeaderText="90-11 Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Date" HeaderText="Date" HeaderStyle-HorizontalAlign="Left" />
                                                </Columns>
                                                <EditRowStyle BackColor="#999999" />
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                            </asp:GridView>
                                        </div>
                                        
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <div class="row-fluid">
                                <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="btnShowReport" />
                                    </Triggers>
                                    <ContentTemplate>
                                        <div class="span6">
                                            <asp:GridView ID="grdCustomerMatchReport" runat="server" AutoGenerateColumns="False"
                                                CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" OnRowDataBound="grdCustomerMatchReport_RowDataBound">
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                <Columns>
                                                    <asp:BoundField DataField="ClientName" HeaderText="Name" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="TeamName" HeaderText="Team" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Rate" HeaderText="Rate" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="BettingFor" HeaderText="BettingFor" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Amount" HeaderText="Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="TeamAAmount" HeaderText="Team A Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="TeamBAmount" HeaderText="Team B Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="DrawAmount" HeaderText="Draw Chips" HeaderStyle-HorizontalAlign="Left" />
                                                </Columns>
                                                <EditRowStyle BackColor="#999999" />
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                            </asp:GridView>
                                        </div>
                                        <div class="span6">
                                            <asp:Label ID="lblSTeamAAmount" runat="server"></asp:Label>
                                            <asp:Label ID="lblSTeamBAmount" runat="server"></asp:Label>
                                            <asp:Label ID="lblSDrawAmount" runat="server"></asp:Label>
                                            <asp:GridView ID="grdCustomerBettingSession" runat="server" AutoGenerateColumns="False"
                                                CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%">
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                <Columns>
                                                    <asp:BoundField DataField="FullName" HeaderText="Client Name" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Abbrivation" HeaderText="Team Name" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Over" HeaderText="Over" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Rate" HeaderText="Run" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="BettingFor" HeaderText="K/L" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="BettingAmount" HeaderText="Betting Chips" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="Date" HeaderText="Date" HeaderStyle-HorizontalAlign="Left" />
                                                </Columns>
                                                <EditRowStyle BackColor="#999999" />
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                            </asp:GridView>
                                        </div>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
